package com.anglireports.report.bean.report;

import com.anglireports.report.bean.base.BaseBean;
import com.anglireports.report.response.util.DateUtil;

import java.util.Date;

/**
 * 报告-上课记录
 * @author lvjilei
 * @ceateTime 2019/3/25.
 */
public class Reports extends BaseBean {

    /**
     * 上课记录id
     */
    private String _id;

    /**
     * 课程id
     */
    private String course_id;

    /**
     * 教师id
     */
    private String teacher_id;

    /**
     * 学生id
     */
    private String student_id;

    /**
     * 此学生开始上课的时间
     */
    private String start_time;

    /**
     * 下课时间
     */
    private String end_time;

    /**
     * 有出席该堂课的同学数目
     */
    private String student_count;

    /**
     * 学生上课情
     */
    private Emotion emotion;

    /**
     * 学生举手次数
     */
    private Integer hands_up_count;

    /**
     * 学生举手次数排名
     */
    private Integer hands_up_rank;

    /**
     * 学生开口时数
     */
    private Integer speaking_time;

    /**
     * 学生开口时数排名
     */
    private Integer speaking_rank;

    /**
     * 学生专注度
     */
    private Concentration concentration;

    /**
     * 学生专排名
     */
    private Integer concentrationRank;

    /**
     * 学生活跃度
     */
    private Vitality vitality;

    /**
     * 学生活跃度排名
     */
    private Integer vitalityRank;

    /**
     * 学生头部面对方向的次数统计，
     * 依序为面对上方、右边、下方、
     * 左边、中间的次数。
     */
    private Integer[] headpose;

    /**
     * 学生头部视线方向的次数统计，
     * 依序为视线朝上方、右边、下方、
     * 左边、中间的次数。
     */
    private Integer[] gaze;


    public Reports() {
    }

    public String get_id() {
        return _id;
    }

    public void set_id(String _id) {
        this._id = _id;
    }

    public String getCourse_id() {
        return course_id;
    }

    public void setCourse_id(String course_id) {
        this.course_id = course_id;
    }

    public String getTeacher_id() {
        return teacher_id;
    }

    public void setTeacher_id(String teacher_id) {
        this.teacher_id = teacher_id;
    }

    public String getStudent_id() {
        return student_id;
    }

    public void setStudent_id(String student_id) {
        this.student_id = student_id;
    }

    public String getStart_time() {
        return start_time;
    }

    public void setStart_time(String start_time) {
        this.start_time = start_time;
    }

    public String getEnd_time() {
        return end_time;
    }

    public void setEnd_time(String end_time) {
        this.end_time = end_time;
    }

    public String getStudent_count() {
        return student_count;
    }

    public void setStudent_count(String student_count) {
        this.student_count = student_count;
    }

    public Emotion getEmotion() {
        return emotion;
    }

    public void setEmotion(Emotion emotion) {
        this.emotion = emotion;
    }

    public Integer getHands_up_count() {
        return hands_up_count;
    }

    public void setHands_up_count(Integer hands_up_count) {
        this.hands_up_count = hands_up_count;
    }

    public Integer getHands_up_rank() {
        return hands_up_rank;
    }

    public void setHands_up_rank(Integer hands_up_rank) {
        this.hands_up_rank = hands_up_rank;
    }

    public Integer getSpeaking_time() {
        return speaking_time;
    }

    public void setSpeaking_time(Integer speaking_time) {
        this.speaking_time = speaking_time;
    }

    public Integer getSpeaking_rank() {
        return speaking_rank;
    }

    public void setSpeaking_rank(Integer speaking_rank) {
        this.speaking_rank = speaking_rank;
    }

    public Concentration getConcentration() {
        return concentration;
    }

    public void setConcentration(Concentration concentration) {
        this.concentration = concentration;
    }

    public Integer getConcentrationRank() {
        return concentrationRank;
    }

    public void setConcentrationRank(Integer concentrationRank) {
        this.concentrationRank = concentrationRank;
    }

    public Vitality getVitality() {
        return vitality;
    }

    public void setVitality(Vitality vitality) {
        this.vitality = vitality;
    }

    public Integer getVitalityRank() {
        return vitalityRank;
    }

    public void setVitalityRank(Integer vitalityRank) {
        this.vitalityRank = vitalityRank;
    }

    public Integer[] getHeadpose() {
        return headpose;
    }

    public void setHeadpose(Integer[] headpose) {
        this.headpose = headpose;
    }

    public Integer[] getGaze() {
        return gaze;
    }

    public void setGaze(Integer[] gaze) {
        this.gaze = gaze;
    }


    public Reports megreReportsData(Reports megreReports){
        this.setStart_time(DateUtil.compareTime(this.getStart_time(), megreReports.getStart_time())?
                this.getStart_time() : megreReports.getStart_time());
        this.setEnd_time(DateUtil.compareTime(this.getEnd_time(), megreReports.getEnd_time())?
                megreReports.getEnd_time() : this.getEnd_time());
        this.setHands_up_count(this.getHands_up_count() + megreReports.getHands_up_count());
        this.setHands_up_rank(this.getHands_up_rank() > megreReports.getHands_up_rank() ?
                this.getHands_up_rank():megreReports.getHands_up_rank());
        this.setSpeaking_time(this.getSpeaking_time() + megreReports.getSpeaking_time());
        this.setSpeaking_rank(this.getSpeaking_rank() > megreReports.getSpeaking_rank() ?
                this.getHands_up_rank():megreReports.getSpeaking_rank());
        this.setEmotion(this.getEmotion().megreEmotion(megreReports.getEmotion()));
        this.setConcentration(this.getConcentration().megreConcentration(megreReports.getConcentration()));
        this.setConcentrationRank(this.getConcentrationRank() > megreReports.getConcentrationRank() ?
                this.getConcentrationRank():megreReports.getConcentrationRank());
        this.setVitality(this.getVitality().megreVitality(megreReports.getVitality()));
        this.setVitalityRank(this.getVitalityRank() > megreReports.getVitalityRank() ?
                this.getVitalityRank():megreReports.getVitalityRank());
        this.setHeadpose(megerArray(this.getHeadpose(), megreReports.getHeadpose()));
        this.setGaze(megerArray(this.getGaze(), megreReports.getGaze()));
        return this;
    }

    public Integer[] megerArray(Integer[] aArray , Integer[] bArray){
        Integer[] resultArray = new Integer[aArray.length];
        for(int i = 0 ; i < aArray.length ; i++){
            resultArray[i] = aArray[i] + bArray[i];
        }
        return resultArray;
    }
}
